package com.itheima.homework4;

import java.util.concurrent.ConcurrentHashMap;

public class Demo4_ConcurrentHashMap {
    public static void main(String[] args) {
        ConcurrentHashMap<Integer,Integer> map = new ConcurrentHashMap<>();
        new Thread(()->{
            for (int i = 1; i <= 10; i++) {
                map.put(i,i);
            }
        }).start();
        new Thread(()->{
            for (int i = 11; i <= 20; i++) {
                map.put(i,i);
            }
        }).start();
        map.forEach((k,v)-> System.out.println(k+"---"+v));
    }
}
